<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'show.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<link rel="stylesheet" href="css/pintuer.css">
<link rel="stylesheet" href="css/admin.css">
<script src="/js/jquery.js"></script>
<script src="/js/pintuer.js"></script>
<script src="/js/ajax.js"></script>
</head>
<body>
	<form method="post" action="" id="listform">
		<div class="panel admin-panel">
			<div class="panel-head">
				<strong class="icon-reorder"> 内容列表</strong> <a href=""
					style="float: right; display: none;">添加字段</a>
			</div>
			<div class="padding border-bottom">
				<ul class="search" style="padding-left: 10px;">
					<li><a class="button border-main icon-plus-square-o"
						href="/video.net/jsp/AE/add.jsp"> 添加内容</a></li>
					<li>搜索：</li>
					<li>首页 <select name="s_ishome" class="input"
						onchange="changesearch()"
						style="width: 60px; line-height: 17px; display: inline-block">
							<option value="">选择</option>
							<option value="1">是</option>
							<option value="0">否</option>
					</select> &nbsp;&nbsp; 推荐 <select name="s_isvouch" class="input"
						onchange="changesearch()"
						style="width: 60px; line-height: 17px; display: inline-block">
							<option value="">选择</option>
							<option value="1">是</option>
							<option value="0">否</option>
					</select> &nbsp;&nbsp; 置顶 <select name="s_istop" class="input"
						onchange="changesearch()"
						style="width: 60px; line-height: 17px; display: inline-block">
							<option value="">选择</option>
							<option value="1">是</option>
							<option value="0">否</option>
					</select>
					</li>
					<if condition="$iscid eq 1">
					<li><select name="cid" class="input"
						style="width: 200px; line-height: 17px;" onchange="changesearch()">
							<option value="">请选择分类</option>
							<option value="">产品分类</option>
							<option value="">产品分类</option>
							<option value="">产品分类</option>
							<option value="">产品分类</option>
					</select></li>
					</if>
					<form action="/videomessage/data.do" method="post">
						<li><input type="text" placeholder="输入查询的ID号" name="videoid"
							class="input"
							style="width: 250px; line-height: 17px; display: inline-block" />

						</li>
						<li><input type="text" placeholder="输入查询的视频名称"
							name="videoname" class="input"
							style="width: 250px; line-height: 17px; display: inline-block" />
							<input type="submit" class="button border-main icon-search"
							value="搜索"></li>
					</form>
				</ul>
			</div>
			<table class="table table-hover text-center">
				<tr>
					<th width="100" style="text-align: left; padding-left: 20px;">视频ID</th>
					<th width="10%">视频名字</th>
					<th>视频状态</th>
					<th>视频分类</th>
					<th>视频标签</th>
					<th>展示区域</th>
					<th>视频介绍</th>
					<th>上传时间</th>
					<th>热度</th>
					<th>操作</th>
				</tr>
				<volist name="list" id="vo"> <<c:forEach var="video"
					items="${list}">
					<tr>
						<td style="text-align: left; padding-left: 20px;"><input
							type="text" name="id[]" value="${video.videoid }" /></td>
						<td><input type="text" name="sort[1]"
							value="${video.videoname } "
							style="width: 50px; text-align: center; border: 1px solid #ddd; padding: 7px 0;" /></td>
						<c:choose>
							<c:when test="${video.videostate eq 1}">
								<td><input type="text" value="已上架"></td>
							</c:when>
							<c:otherwise>
								<td><input type="text" value="已下架"></td>
							</c:otherwise>

						</c:choose>


						<td>${video.videotype}</td>

						<td><font color="#00CC99">${video.labelname}</font></td>


						<td>${video.videoarea}</td>

						<td>${video.videorecommend}</td>
						<td>${video.releasetime}</td>
						<td>${video.hot}</td>
						<td>
							<div class="button-group">
								<a class="button border-main"
									href="/videomessage/get.do?videoid=${video.videoid} "><span
									class="icon-edit"></span> 修改</a>
								<c:choose>
									<c:when test="${video.videostate eq 1}">
										<a class="button border-red"
											href="/videomessage/updateState.do?id=${video.videoid } "
											onclick="return del(1,1,1)"><span class="icon-trash-o"></span>
											下架</a>
									</c:when>
									<c:otherwise>
										<a class="button border-red"
											href="/videomessage/updateState.do?id=${video.videoid }"
											onclick="return del(1,1,1)"><span class="icon-trash-o"></span>上架</a>
									</c:otherwise>
								</c:choose>



							</div>
						</td>
					</tr>
				</c:forEach>
				<tr>
					<td colspan="8"><div class="pagelist">
							<a href="/videomessage/data.do?pageNum=1">首页</a>

							<c:set var="num" value="${pageNum}"></c:set>
							<c:choose>
								<c:when test="${pageNum==1}">
									<a href="javascript::">上一页</a>
								</c:when>
								<c:otherwise>
									<a href="/videomessage/data.do?pageNum=${pageNum-1}">上一页</a>
								</c:otherwise>
							</c:choose>

							<c:choose>
								<c:when test="${pageNum eq pageMax}">
									<a href="javascript::">下一页</a>
								</c:when>
								<c:otherwise>
									<a href="/videomessage/data.do?pageNum=${pageNum+1}">下一页</a>
								</c:otherwise>
							</c:choose>
							<a href="#">${pageNum}/${pageMax}</a> <a
								href="/videomessage/data.do?pageNum=${pageMax}">尾页</a></td>
				</tr>
			</table>
		</div>
	</form>
	<script type="text/javascript">

//搜索

function SeachByColumn(videoid,videoname) {
	this.videoid=videoid;
	this.videoname=videoname;
}	

function changesearch(){	
	
	var videoid1=$("input[name='videoid']").val(); 
	var videoname1=$("input[name='videoname']").val();
	var SeachByColumnRef=new SeachByColumn(videoid1,videoname1);
	//JSON.stringify() 方法用于将 JavaScript 值转换为 JSON 字符串。
	var Seach=JSON.stringify(SeachByColumnRef);

	//$.post("/videomessage/data.do",Seach,function(resultJSONObject){
	       //if(resultJSONObject.success){
	         // alert("系统提示","添加成功","info");
	       //}else{
	         // alert("系统提示","添加失败","error");
	       //}
	//},"json");
    ajaxPost("/videomessage/data.do",Seach,function(data){
      
    	
    	 alert("系统提示","添加成功","info");
    });

	
}

//单个删除
function del(id,mid,iscid){
	if(confirm("您确定要下架吗?")){
		
	}
}

//全选
$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

//批量删除
function DelSelect(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;		
		$("#listform").submit();		
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

//批量排序
function sorts(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){	
		
		$("#listform").submit();		
	}
	else{
		alert("请选择要操作的内容!");
		return false;
	}
}


//批量首页显示
function changeishome(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");		
	
		return false;
	}
}

//批量推荐
function changeisvouch(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");	
		
		return false;
	}
}

//批量置顶
function changeistop(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){		
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");		
	
		return false;
	}
}


//批量移动
function changecate(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){		
		
		$("#listform").submit();		
	}
	else{
		alert("请选择要操作的内容!");
		
		return false;
	}
}

//批量复制
function changecopy(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){	
		var i = 0;
	    $("input[name='id[]']").each(function(){
	  		if (this.checked==true) {
				i++;
			}		
	    });
		if(i>1){ 
	    	alert("只能选择一条信息!");
			$(o).find("option:first").prop("selected","selected");
		}else{
		
			$("#listform").submit();		
		}	
	}
	else{
		alert("请选择要复制的内容!");
		$(o).find("option:first").prop("selected","selected");
		return false;
	}
}

</script>

</body>
</html>
